from database.base_db import DatabaseManage


class StudentDB(DatabaseManage):
    def fetch_students(self):
        query = """SELECT s.*,c.class_name,(s.chinese_score +s.math_score+s.english_score)as total_score FROM 
        student s JOIN classes c on s.class_id = c.class_id"""
        return self.fetch_query(query)

if __name__ == '__main__':
    with StudentDB() as db:
       result = db.fetch_students()
       print("查询结果:",result)